import javax.swing.*;
import java.awt.*;


public class Console extends JPanel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 6358698941421332612L;
	private JTextArea console; 
	private boolean debutConsole = true;
	
	public Console(){
		super();
		this.setLayout(new BorderLayout());//adapte le JTextArea � la fenetre de la console
		console = new JTextArea();
		//console.setEditable(false);
		this.add(new JScrollPane(console), BorderLayout.CENTER);
	}
	
	public void out(String resultat)
	{	
		console.setForeground(Color.GREEN);
		if(debutConsole)
		{console.append(resultat);
		 debutConsole=false;
		}	
		else	
			console.append("\n"+resultat);
	}
	
	public void sys(String resultat)
	{
		console.setForeground(Color.BLUE);
		if(debutConsole)
		{console.append(resultat);
		 debutConsole=false;
		}	
		else

			console.append("\n"+resultat);
	}
	
	public void err(String resultat)
	{
		console.setForeground(Color.RED);
		if(debutConsole)
		{console.append(resultat);
		 debutConsole=false;
		}	
		else			
			console.append("\n"+resultat);
	}
}
